﻿@************************************************************************************//
// Autor:  				                						     				*//
//***********************************************************************************//
// SearchIndex()	Acceso INVITADO	y ADMINISTRADOR									*//
// Vista que devuelve todos los ítems de Localidad listados, paginados y con opción	*//
// de búsqueda.		 																*//
// _________________________________________________________________________________*@
		
@model PagedList.IPagedList<SIBI.Models.LOCALIDAD>

@{
    ViewBag.Title = "Localidad";
}

<h2>Localidad</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

    @using (Html.BeginForm()){   
            <table width="100%">
                    <tr>
                        <td> 
                            Nombre:<br /> @Html.TextBox("SearchEmp", ViewBag.CurrentEmp as string) &nbsp;
                        </td>
                        <td>   
                            Código:<br /> @Html.TextBox("SearchNPer", ViewBag.CurrentNper as string) &nbsp;
                        </td>
                    </tr>
            </table>
         <input type="submit" value="Filtrar" />
    }

<br />
<table width="50%">
    <tr>
        <th>
            Nombre
        </th>
        <th>
            Código
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.localidad_nombre)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.localidad_id)
        </td>
        <td>
            @Html.ActionLink("Detalles", "Details", new { id=item.localidad_id })
        </td>
    </tr>
}

</table>

<br />

<div>
    Pag @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
    de @Model.PageCount
    &nbsp;
    @if (Model.HasPreviousPage)
    {
        @Html.ActionLink("<<= ", "SearchIndex", new { page = 1, currentNPer = ViewBag.CurrentNPer, currentEmp = ViewBag.CurrentEmp})
        @Html.Raw("&nbsp;");
        @Html.ActionLink("<=", "SearchIndex", new { page = Model.PageNumber - 1, currentNPer = ViewBag.CurrentNPer, currentEmp = ViewBag.CurrentEmp})
    }
    else
    {
        @:<<=
        @Html.Raw("&nbsp;");
        @:<=
    }
    &nbsp;
    @if (Model.HasNextPage)
    {
        @Html.ActionLink("=>", "SearchIndex", new { page = Model.PageNumber + 1, currentNPer = ViewBag.CurrentNPer, currentEmp = ViewBag.CurrentEmp})
        @Html.Raw("&nbsp;");
        @Html.ActionLink(" =>>", "SearchIndex", new { page = Model.PageCount, currentNPer = ViewBag.CurrentNPer, currentEmp = ViewBag.CurrentEmp})
    }
    else
    {
        @:=>
        @Html.Raw("&nbsp;")
        @:=>>
    }
</div>